package com.yzl.meeting.framework.pojo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Title: BeanDefinition
 * @Author: 姚志立
 * @Description:描述类
 * @Date: 2020/10/7 14:53
 * @Version: 1.0
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BeanDefinition {
    private static final String SCOPE_SINGLETON = "singleton";
    private static final String SCOPE_PROTOTYPE = "prototype";
    private String typeName;//类名
    private Class typeClass;//类对象
    private Class annotationClass;//注解的类对象
    private String annotationMappingName;//注解的映射路径
    private List<MethodDefinition> methodDefinitions;//类包含的所有方法
    private String scope;
    @Builder.Default
    private boolean isSingleton = true;
    @Builder.Default
    private boolean isPrototype = false;

    private List<PropertyValue> propertyValueList = new ArrayList<>();
    public void setScope(String scope) {
        this.scope = scope;
        if(scope.equals(SCOPE_PROTOTYPE)){
            setPrototype(true);
            setSingleton(false);
        }else if(scope.equals(SCOPE_SINGLETON)){
            setPrototype(false);
            setSingleton(true);
        }else {
            setPrototype(false);
            setSingleton(true);
        }}

}
